<template>
  <div class="index">
    <el-container>
      <el-header height="68px">
        <m-header></m-header>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <m-aside></m-aside>
        </el-aside>
        <el-main>
          <div class="main">
            <div class="header-top">
              <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>联系方式</el-breadcrumb-item>
              </el-breadcrumb>
              <h2 class="title">联系方式</h2>
            </div>
            <div class="row">
              
                <el-form ref="form" :model="form" label-width="80px" >
                    <el-form-item label="联系方式" >
                        <el-input type="textarea"  v-model="form.desc" :rows="10" ></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">提交</el-button>
                    </el-form-item>
                </el-form>
                
            </div>

          </div>
        </el-main>
      </el-container>
      
    </el-container>
  </div>
</template>
<script>
import { getCookie,timeChange,getQueryString } from "./until/index";
function init(){
  this.$ajax.get("admGetSysParameterList.ashx?token=" +getCookie("token")+'&groupName=SYS_CONTACT_INFO')
      .then(res => {
        
        if (res.data.code === "200") {
          var data = res.data.data;
          
          this.form.desc = data.ParamList[0].paraValue;

        } else {
          this.$message.error(res.data.msg );
        }
      })
      .catch(error => {
        console.log(error);
      });
}
function feedbackStatus(row){//改变联系方式
  this.$ajax.get("admSaveSysParameter.ashx?token=" +getCookie("token")+'&paraName=SYS_CONTACT_INFO'+'&paraValue='+row)
      .then(res => {
        if (res.data.code === "200") {
          this.$message({
            type: 'success',
            message: res.data.msg,
            onClose:()=>{

              init.call(this)
            }
          });

        } else {
          this.$message.error(res.data.msg );
        }
      })
      .catch(error => {
        console.log(error);
      });
}

export default {
  data() {
    return {
      tableData: [],
      type:'',
      form:{
        desc:''
      }

    };
  },
  created() {
    
    
    init.call(this)
  },
  methods: {
    
    handleCurrentChange(num) {
      this.currentPage = num;
      init.call(this)
    },
    handleSizeChange(val) {
      this.pagesize = val;
      init.call(this)
    },
    onSubmit(row){//提交
      
        
      this.$confirm('是否更改联系方式？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        feedbackStatus.call(this,this.form.desc)
        
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消退出'
        });          
      });
      
    
    },
    
  }
};
</script>
<style scoped>
.index {
  overflow: hidden;
}
.el-textarea{width: 40%}
.water{margin-right: 20px;display: inline-block}
.waterTime{font-size: 14px;color: #606266;padding: 0 12px 0 0;box-sizing: border-box;}
.el-header {
  background-color: #3a4759;
  color: #fff;
}
.el-aside {
  background-color: #485668;
  color: #333;
  text-align: center;
  line-height: 200px;
  overflow: hidden;
}
.el-main {
  background-color: #f0f2f5;
  color: #333;
  text-align: center;
  height: 100%;
  min-height: 740px
}

.text-style .el-form-item__content span,.el-select{margin-left: 25px}
.diaself .el-dialog__header{padding:0 !important}
.el-dialog--center .el-dialog__body {
    padding: 0;
}
.el-form-item{margin-bottom: 10px}
.header-top{
  margin: -20px -20px 20px;
  padding: 15px 20px;
  background: #fff;
  
}
.header-top .title{
  margin:15px 0 0;
  font-weight: 600;
  text-align: center;
  font-size: 20px;
}
.row{
  background: #fff;
  padding: 20px 30px;
  text-align: left
}
.block {
  padding: 20px;
}
.message{
  margin-top: 20px;
}
</style>
  